package com.ruoyi.dynamic.controller.app;


import com.ruoyi.common.core.constant.constant.PathConstant;
import com.ruoyi.common.core.context.SecurityContextHolder;
import com.ruoyi.common.core.pojo.vo.BaseVO;
import com.ruoyi.common.core.result.Result;
import com.ruoyi.dynamic.model.pojo.request.app.AppGiftGiveRequest;
import com.ruoyi.dynamic.service.IPayService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

@Tag(name = "App-支付相关", description = "App-支付相关")
@RestController
@RequestMapping(PathConstant.APP_PATH + "pay")
public class AppPayController {

    @Autowired
    private IPayService iPayService;

    @Operation(summary = "赠送礼物", description = "赠送礼物")
    @PostMapping("giveGift")
    public BaseVO listPage(@RequestBody @Validated AppGiftGiveRequest request) {
        Long userId = SecurityContextHolder.getUserId();
        boolean add = iPayService.giveGift(request, userId);
        return Result.successOrFail(add);
    }


}

